package com.teamcenter.rac.massupdate.model;

import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.massupdate.utils.SourceHelper;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource;
@SuppressWarnings({"rawtypes","unchecked"})
public abstract class AbstractWrappedPropertySource
  extends AbstractObservablePropertySource
  implements IAdaptable
{
  protected Set<String> m_localPropNames;
  protected IPropertyDescriptor[] m_propertyDescriptors;
  private IPropertySource m_wrappedPropertySource;
  
  protected AbstractWrappedPropertySource(int paramInt)
  {
    super(paramInt);
    this.m_localPropNames = new HashSet(paramInt);
  }
  
  public IPropertyDescriptor[] getPropertyDescriptors()
  {
    List localList = getWrappedPropertyDescriptors(this.m_localPropNames.size());
    return (IPropertyDescriptor[])localList.toArray(new IPropertyDescriptor[localList.size()]);
  }
  
  public Object getPropertyValue(Object paramObject)
  {
    if (paramObject != null)
    {
      if (this.m_localPropNames.contains(paramObject)) {
        return super.getPropertyValue(paramObject);
      }
      IPropertySource localIPropertySource = getWrappedPropertySource();
      if (localIPropertySource != null) {
        return localIPropertySource.getPropertyValue(paramObject);
      }
    }
    return null;
  }
  
  public boolean isPropertySet(Object paramObject)
  {
    if (this.m_localPropNames.contains(paramObject)) {
      return super.isPropertySet(paramObject);
    }
    IPropertySource localIPropertySource = getWrappedPropertySource();
    if (localIPropertySource != null) {
      return localIPropertySource.isPropertySet(paramObject);
    }
    return false;
  }
  
  public void setPropertyValue(Object paramObject1, Object paramObject2)
  {
    if (this.m_localPropNames.contains(paramObject1))
    {
      super.setPropertyValue(paramObject1, paramObject2);
      return;
    }
    IPropertySource localIPropertySource = getWrappedPropertySource();
    if (localIPropertySource != null)
    {
      Object localObject = localIPropertySource.getPropertyValue(paramObject1);
      localIPropertySource.setPropertyValue(paramObject1, paramObject2);
      firePropertyChange((String)paramObject1, localObject, paramObject2);
    }
  }
  
  public Object getAdapter(Class paramClass)
  {
    if (IPropertySource.class.isAssignableFrom(paramClass)) {
      return this;
    }
    if (TCComponent.class.isAssignableFrom(paramClass)) {
      return SourceHelper.getAssociatedComponent(getWrappedPropertySource(), getTCSession());
    }
    return null;
  }
  
  protected List<IPropertyDescriptor> getWrappedPropertyDescriptors(int paramInt)
  {
    IPropertySource localIPropertySource = getWrappedPropertySource();
    ArrayList localArrayList;
    if (localIPropertySource != null)
    {
      IPropertyDescriptor[] arrayOfIPropertyDescriptor = localIPropertySource.getPropertyDescriptors();
      localArrayList = new ArrayList(arrayOfIPropertyDescriptor.length + paramInt);
      Collections.addAll(localArrayList, arrayOfIPropertyDescriptor);
    }
    else
    {
      localArrayList = new ArrayList(paramInt);
    }
    return localArrayList;
  }
  
  protected IPropertySource getWrappedPropertySource()
  {
    return this.m_wrappedPropertySource;
  }
  
  protected void setWrappedPropertySource(IPropertySource paramIPropertySource)
  {
    this.m_propertyDescriptors = null;
    this.m_wrappedPropertySource = paramIPropertySource;
  }
}


/* Location:              D:\下载\Fw_ 金卡反编译需求\com.teamcenter.rac.massupdate_11000.2.0.jar!\com\teamcenter\rac\massupdate\model\AbstractWrappedPropertySource.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */